package fr.labri.macchiato.ui.cart.events;

import java.util.List;

import fr.labri.macchiato.core.model.Article;
import fr.labri.macchiato.core.model.Offer;
import fr.labri.macchiato.ui.cart.ModelSearch;
import fr.labri.macchiato.ui.cart.OfferSearch;
import fr.labri.macchiato.ui.cart.ProductSearch;

/**
 * Handler to be used retrieve the selected results of a {@link ProductSearch}
 * 
 * @author psarraut
 *
 */
public abstract class ValidateSearchHandler {

	private List<Article> selectedModels;
	private Offer selectedOffer;
	
	/**
	 * Return the selected offer of a {@link ModelSearch}
	 * 
	 * @return The selected offer
	 */
	public Offer getSelectedOffer() {
		return selectedOffer;
	}

	/**
	 * Set the offer selected by the user
	 * Should be only used in {@link OfferSearch}
	 * 
	 * @param selectedOffer The selected offer
	 */
	public void setSelectedOffer(Offer selectedOffer) {
		this.selectedOffer = selectedOffer;
	}

	/**
	 * Set the models selected by the user
	 * Should be only used in {@link ModelSearch}
	 * 
	 * @param selectedModels
	 */
	public void setSelectedModels(List<Article> selectedModels) {
		this.selectedModels = selectedModels;
	}

	/**
	 * Return the selected models of a {@link ModelSearch}
	 * 
	 * @return The selected models
	 */
	protected List<Article> getSelectedModels() {
		return selectedModels;
	}

	/**
	 * Launch the specified event
	 */
	public abstract void fireEvent();

}
